package tx.service;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author jackcfan
 * @date 22/10/11
 */
@Service
public class UserTest2Service {
  @Resource
  JdbcTemplate jdbcTemplate;

  @Transactional
  public void methodA() throws NullPointerException{
    jdbcTemplate.update("insert into user(name,age) values(?,?)","李四1",50);
    throw new NullPointerException();
  }

  @Transactional
  public void methodB()  throws IOException {
    jdbcTemplate.update("insert into user(name,age) values(?,?)","李四2",60);
    throw new IOException();
  }

  public void methodC() throws NullPointerException{
    jdbcTemplate.update("insert into user(name,age) values(?,?)","李四3",70);
    throw new NullPointerException();
  }
}
